﻿using Game.Entity.Treasure;
using Game.Facade;
using Game.Utils;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Game.Web.Mobile
{
    public partial class MoblieVideoInfo : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            string vNumber = GameRequest.GetQueryString("vNumber");
            if(string.IsNullOrEmpty(vNumber))
            {
                Response.Write("抱歉，参数错误");
                return;
            }
            
            if(!Regex.IsMatch(vNumber, @"^\d{5,}$"))
            {
                Response.Write("抱歉，参数格式异常");
                return;
            }

            RecordVideoInfo info = FacadeManage.aideTreasureFacade.GetRecordVideoInfoByVNumber(vNumber);
            if(info == null)
            {
                Response.Write("抱歉，存盘信息不存在");
                return;
            }
            Response.ClearContent();
            Response.ContentType = "video/x-msvideo";
            Response.BinaryWrite(info.VideoData);
            Response.End();
        }
    }
}